<?php
/*
 * 特卖会2.0.0 留言反馈
 */

if (!defined('IN_SEXMALL')){
	die('Hacking attempt');
}

$user_token = $mem->getCache('user_token');
if (empty($user_token)){
	//wap_header("Location:user-login.html\n");
	wap_header("Location: index.php?m=user&act=login");
}

if (!empty($_POST['mailormobile']) && !empty($_POST['msg']))
{

	$useragent=$_SERVER['HTTP_USER_AGENT'];
	$mailormobile = htmlspecialchars(trim($_POST['mailormobile']));
	$msg_content = htmlspecialchars(trim($_POST['msg']));
	$network = trim($_POST['network']);
	if($network==1)$network='2G';
	if($network==2)$network='3G/wifi';
	$ip = real_ip();

	if($mailormobile && $msg_content && $network)
	{
		$uname = $_COOKIE['WAP']['username'];
		$subject = '来自WAP的用户反馈';
		//$email = array('service@sexmall.com','mobile@sexmall.com','sexmallyj@126.com','ben.cui@sexmall.com');
		$email = '46851594@qq.com';
		$content = "$fromto \n";
		$content.= "----------------------------\n";
		$content.= "会员名：$uname \n";
		$content.= "网络：$network \n";
		$content.= "联系方式：$mailormobile \n";
		$content.= "设备：$useragent \n";
		$content.= "IP：$ip \n";
		$content.= "客户端：WAP \n";

		if(is_array($email))
		{
			foreach ($email as $m)
			{
				$state = send_mail('',$m,$subject,$content);
			}
		}
		else
		{
			$state = send_mail('',$email,$subject,$content);
		}
		$smarty->assign('state', $state);
	}
}

$smarty->display('message.dwt');
